import { createRouter, createWebHistory } from 'vue-router';
import { AppRoutes } from './routes';
import BaseRoutes from './routes/base';

const router = createRouter({
  history: createWebHistory(),
  routes: [...AppRoutes, ...BaseRoutes],
  scrollBehavior: (_to, _from, savedPosition) => {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { top: 0 };
    }
  },
});

export default router;
